<template>
    <div class="app_index">
        <div class="swiper-container">
            <div class="swiper-wrapper">
                <Swiper v-if="slidelist.length > 0">
                    <Slide v-for='(item,index) in slidelist' :key="index">
                        <img class="img" :src="resurl+item.pic+'?x-oss-process=image/resize,m_fill,w_720,h_400'">
                    </Slide>
                </Swiper>
            </div>
        </div>
        <div class="search"><input type="search" v-model="search_name" placeholder="请输入商品名称">
            <div class="btn" @click="tosearch()">搜索</div>
        </div>
        <div class="cate_list">
            <div v-for='(item,index) in cate' :key='index' class="cate">
                <router-link :to="'pages/goods/list?id='+item.id" class="box" v-if="item.up_id==0">
                    <img class="img" :src="resurl+item.pic+'?x-oss-process=image/resize,m_fill,w_240,h_240'">
                    <span>{{item.name}}</span>
                </router-link>
                <router-link :to="'pages/cate/list?id='+item.id" class="box" v-else>
                    <img class="img" :src="resurl+item.pic+'?x-oss-process=image/resize,m_fill,w_240,h_240'">
                    <span>{{item.name}}</span>
                </router-link>
            </div>
        </div>

        <!--<div class="statistics">-->
        <!--<div class="box">-->
        <!--<div class="title">用户数</div>-->
        <!--<div class="number">{{user_number}}</div>-->
        <!--</div>-->
        <!--<div class="box">-->
        <!--<div class="title">群主数</div>-->
        <!--<div class="number">{{group_number}}</div>-->
        <!--</div>-->
        <!--</div>-->

        <div class="good_box">
            <div class="title">推荐商品</div>

            <div class="goods_list">
                <div v-for='(item,index) in goods' :key='index' class="goods_item">
                    <router-link class="goods" :to="'/pages/goods/detail?id='+item.id">
                        <div class="pic"><img :src="resurl+item.pic+'?x-oss-process=image/resize,m_fill,w_240,h_240'"
                                              alt=""></div>
                        <div class="info">
                            <div class="name">{{item.name}}</div>
                            <div class="sales">销量:{{item.sales}}</div>
                            <div class="price">￥{{item.price}}</div>
                        </div>
                    </router-link>
                    <div class="golist">
                        <div v-for="(goitem,goindex) in item.golist" class="go">
                            <div class="endtime_str endtime" v-html="goitem.endtime_str"></div>
                            <div class="price">团购价格: <span>￥{{goitem.price}}</span></div>
                            <div class="number">参团人数:{{goitem.current_number}}/{{goitem.number}}</div>
                            <router-link class="btn" :to="'pages/go/detail?id='+goitem.id">立即参团</router-link>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="good_box">
            <div class="title">热销商品</div>
            <div class="goods_list">
                <div v-for='(item,index) in hot_goods' :key='index' class="goods_item">
                    <router-link class="goods" :to="'/pages/goods/detail?id='+item.id">
                        <div class="pic"><img :src="resurl+item.pic+'?x-oss-process=image/resize,m_fill,w_240,h_240'"
                                              alt=""></div>
                        <div class="info">
                            <div class="name">{{item.name}}</div>
                            <div class="sales">销量:{{item.sales}}</div>
                            <div class="price">￥{{item.price}}</div>
                        </div>
                    </router-link>
                    <div class="golist">
                        <div v-for="(goitem,goindex) in item.golist" class="go">
                            <div class="endtime_str endtime" v-html="goitem.endtime_str"></div>
                            <div class="price">团购价格: <span>￥{{goitem.price}}</span></div>
                            <div class="number">参团人数:{{goitem.current_number}}/{{goitem.number}}</div>
                            <router-link class="btn" :to="'/pages/go/detail?id='+goitem.id">立即参团</router-link>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div id="menu_box" style="height: 50px"></div>
        <main_menu index="0" :group_code="user.group_code"></main_menu>
    </div>
</template>
<script src="./main.js"></script>
<style lang="less" src="./main.less" scoped></style>
<style>
    .swiper-container img {
        width: 100%;
        height: 100%;
    }
</style>